<template>
  <div>{{ txt }}</div>
  <span>count： {{ count }}</span>
  <br />
  <span>doubleCount：{{ doubleCount }}</span>
  <el-button type="success" plain @click="counterStore.increment()">
    +1
  </el-button>
</template>

<script setup>
import { ref } from "vue";

import { storeToRefs } from "pinia";
import { useCounterStore } from "../store/counter";
// import { https } from "../api/http";

const counterStore = useCounterStore();
console.log(counterStore);
const { count, doubleCount, increment } = storeToRefs(counterStore);
// console.log(counterStore);

const txt = ref("test111");

// 监听整个仓库
counterStore.$subscribe((mutation, state) => {
  console.log("mutation==> ", mutation);
  console.log("state==> ", state);
});
</script>

<style>
</style>